#!/bin/sh

for i in $PLIBDIRS # $PLIBDIRS is exported in 2createpackages
do
	[ -d $i ] || continue
	if [ -e ${i}/libreadline.so.8 ] ; then
		ln -sv libreadline.so.8 ${i}/libreadline.so.4 2>/dev/null
		ln -sv libreadline.so.8 ${i}/libreadline.so.5 2>/dev/null
		ln -sv libreadline.so.8 ${i}/libreadline.so.6 2>/dev/null
		ln -sv libreadline.so.8 ${i}/libreadline.so.7 2>/dev/null
		ln -sv libhistory.so.8 ${i}/libhistory.so.7 2>/dev/null
	elif [ -e ${i}/libreadline.so.7 ] ; then
		ln -sv libreadline.so.7 ${i}/libreadline.so.4 2>/dev/null
		ln -sv libreadline.so.7 ${i}/libreadline.so.5 2>/dev/null
		ln -sv libreadline.so.7 ${i}/libreadline.so.6 2>/dev/null
	elif [ -e ${i}/libreadline.so.6 ] ; then
		ln -sv libreadline.so.6 ${i}/libreadline.so.4 2>/dev/null
		ln -sv libreadline.so.6 ${i}/libreadline.so.5 2>/dev/null
	elif [ -e ${i}/libreadline.so.5 ] ; then
		ln -sv libreadline.so.5 ${i}/libreadline.so.4 2>/dev/null
	fi
done
